package com.edgardeng.education.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.edgardeng.education.entity.enums.GenderEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;

/**
 * <p>
 * 学生
 * </p>
 *
 * @author edgardeng
 * @since 2020-04-28
 */
@TableName("t_student")
public class Student extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 姓名
     */
    private String name;

    /**
     * 学校ID
     */
    private Long schoolId;

    /**
     * 班级ID
     */
    private Long classId;

    /**
     * 年级，原生枚举（带{@link com.baomidou.mybatisplus.annotation.EnumValue}):
     * 数据库字段：gender_code INT(2)
     * 性别：0未知1男2女
     */
    private GenderEnum genderCode; // 不要使用tinyint 会变成boolean

    /**
     * 生日
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime birthday;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public Long getSchoolId() {
        return schoolId;
    }

    public void setSchoolId(Long schoolId) {
        this.schoolId = schoolId;
    }
    public Long getClassId() {
        return classId;
    }

    public void setClassId(Long classId) {
        this.classId = classId;
    }
    public GenderEnum getGenderCode() {
        return genderCode;
    }
    public void setGenderCode(GenderEnum genderCode) {
        this.genderCode = genderCode;
    }
    public LocalDateTime getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDateTime birthday) {
        this.birthday = birthday;
    }

    @Override
    public String toString() {
        return "Student{" +
            "name=" + name +
            ", schoolId=" + schoolId +
            ", classId=" + classId +
            ", genderCode=" + genderCode +
            ", birthday=" + birthday +
        "}"+ super.toString();
    }
}
